from PSO import PSO
from util import demo_func
import matplotlib.pyplot as plt


function = "sphere"
f = getattr(demo_func, function)

pso = PSO(func=f, n_dim=10, pop=40, max_iter=1500, lb=-100, ub=100, w=0.8, c1=0.5, c2=0.5)
pso.run()
print('best_x is ', pso.gbest_x, 'best_y is', pso.gbest_y)




plt.plot(pso.gbest_y_hist, label="PSO")

plt.show()
